home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / ANGLES.dxr / 00196_Move Slider for Ray.ls < prev    next >
Encoding:
Text File  |  1998-07-22  |  1.5 KB  |  46 lines

  1. property theta, theBottom, theTop
  2.  
  3. on beginSprite me
  4.   set the cursor of sprite the spriteNum of me to [member "hand", member "Hand Mask"]
  5.   set theta to 45
  6.   set theBottom to the locV of sprite the spriteNum of me + 29
  7.   set theTop to the locV of sprite the spriteNum of me - 211
  8. end
  9.  
  10. on endSprite me
  11.   set the cursor of sprite the spriteNum of me to 0
  12. end
  13.  
  14. on mouseDown me
  15.   set the cursor of sprite the spriteNum of me to [member "Closed hand", member "Closed Hand Mask"]
  16.   set moved to 0
  17.   repeat while the stillDown
  18.     if (the mouseV >= theTop) and (the mouseV <= theBottom) then
  19.       set moved to 1
  20.       set the locV of sprite the spriteNum of me to the mouseV
  21.       set theta to 360 - integer((the mouseV - theTop) * 1.5)
  22.       put theta into field "theta"
  23.       clear(member "DAngle")
  24.       set endP to VectorToPoint(member "DAngle", 174, 174, theta, 175)
  25.       if the machineType < 256 then
  26.         SetForeColor(member "DAngle", 255, 0, 255)
  27.         DrawFilledWedge(member "DAngle", 142, 144, 208, 210, 0, theta)
  28.       end if
  29.       SetForeColor(member "DAngle", 0, 0, 255)
  30.       DrawSingleArrow(member "DAngle", 174, 174, the locH of endP, the locV of endP)
  31.       Redraw(member "DAngle")
  32.       updateStage()
  33.     end if
  34.     if moved then
  35.       drawLine(15, 207, 206, the locV of endP + 32, the locH of endP + 31)
  36.       updateStage()
  37.     end if
  38.   end repeat
  39.   set the cursor of sprite the spriteNum of me to [member "hand", member "Hand Mask"]
  40. end
  41.  
  42. on move me, x
  43.   set the locV of sprite the spriteNum of me to theBottom - integer(theta / 1.5)
  44.   set theta to x
  45. end
  46.